class ChatMessage {
  final String text;
  final bool isUser;
  final DateTime timestamp;
  final String? characterName;
  final String? characterDescription;
  final String? characterImageUrl;

  ChatMessage({
    required this.text,
    required this.isUser,
    required this.timestamp,
    this.characterName,
    this.characterDescription,
    this.characterImageUrl,
  });

  Map<String, dynamic> toJson() => {
    'text': text,
    'isUser': isUser,
    'timestamp': timestamp.toIso8601String(),
    'characterName': characterName,
    'characterDescription': characterDescription,
    'characterImageUrl': characterImageUrl,
  };

  factory ChatMessage.fromJson(Map<String, dynamic> json) => ChatMessage(
    text: json['text'] as String,
    isUser: json['isUser'] as bool,
    timestamp: DateTime.parse(json['timestamp'] as String),
    characterName: json['characterName'] as String?,
    characterDescription: json['characterDescription'] as String?,
    characterImageUrl: json['characterImageUrl'] as String?,
  );
} 